package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class TravelQuery extends QueryObject{
    private Long destId=-1L;//目的地
    private int dayType=-1;//旅游天数
    private int perExpendType=-1;//人均消费
    private int travelTimeType=-1;//旅游时间
    private int orderType=1;//排序 默认是最新

    public TravelCondition getDays(){
        return TravelCondition.DAYS_MAP.get(dayType);
    }
    public TravelCondition getPerExpend(){
        return TravelCondition.TRAVEL_PRE_EXPENDS.get(perExpendType);
    }
    public TravelCondition getTravelTime(){
        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }
    public String getOrderBy(){
        return orderType == 1?"t.createTime desc":"t.viewnum desc";//按最热或者最新排序
       /* if(orderType == 1){
            return "t.createTime desc " ;
        }else{
            return "t.viewnum desc";   //最热门
        }*/
    }

   /* private Long destId = -1L;
    private int perExpendType = -1;  //人均消费
    private int travelTimeType = -1;    //旅游时间
    private int dayType = -1;       //旅游天数
    private int orderType = 1;  //排序 默认是最新

    private String orderBy = "t.createTime desc ";  //默认是最新

    //将页面传入key值转换成范围对象
    public TravelCondition getPerExpend(){
        return TravelCondition.TRAVEL_PER_EXPEND.get(perExpendType);
    }
    //旅游时间
    public TravelCondition getTravelTime(){
        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }
    //旅游天数
    public TravelCondition getDay(){
        return TravelCondition.TRAVEL_DAYS.get(dayType);
    }*/
}
